import { BASE_COLORS } from '../../types/interfaces'
import { PRESET_COLORS } from './types'

export function styles(): string {
  return `
    .custom-color-picker {
      --border-color: #dfe1e5;
      --text-color: ${BASE_COLORS.TEXT_PRIMARY};
      --border-radius: 4px;
      --transition-duration: 0.2s;
      
      all: initial !important;
      display: flex !important;
      flex-direction: column !important;
      gap: 12px !important;
      width: 100% !important;
      
      * {
        box-sizing: border-box;
      }
      
      .color-controls {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        
        .text-input-container {
          flex: 1;
          min-width: 0;
        }
        
        .color-input-container {
          position: relative;
          display: flex;
          align-items: center;
          gap: 8px;
          
          input[type="color"] {
            opacity: 0;
            position: absolute;
            width: 100%;
            height: 100%;
            overflow: visible !important;
            cursor: pointer;
            z-index: 1;
            outline: none !important;
          }
          
          .color-preview {
            width: 32px;
            height: 32px;
            border-radius: var(--border-radius);
            border: 1px solid var(--border-color);
            cursor: pointer;
            transition: all var(--transition-duration) ease;
            // 添加透明背景网格样式
            background-image: 
              linear-gradient(45deg, #eee 25%, transparent 25%),
              linear-gradient(-45deg, #eee 25%, transparent 25%),
              linear-gradient(45deg, transparent 75%, #eee 75%),
              linear-gradient(-45deg, transparent 75%, #eee 75%);
            background-size: 16px 16px;
            background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
            
            &:hover {
              transform: scale(1.05);
              box-shadow: 0 1px 2px rgba(0,0,0,0.1);
            }
            
            &[style*="transparent"] {
              // 透明色加强显示
              background-image: 
                linear-gradient(45deg, #ccc 25%, transparent 25%),
                linear-gradient(-45deg, #ccc 25%, transparent 25%),
                linear-gradient(45deg, transparent 75%, #ccc 75%),
                linear-gradient(-45deg, transparent 75%, #ccc 75%) !important;
            }
          }
          
          .color-value {
            font-size: 14px;
            color: var(--text-color);
            cursor: pointer;
            min-width: 70px;
          }
        }
      }
      
      .color-presets {
        display: grid;
        grid-template-columns: repeat(${PRESET_COLORS.length}, 1fr);
        width: 50%;
        gap: 4px;
        
        .color-switch {
          width: 20px;
          height: 20px;
          border-radius: 50%;
          border: 1px solid var(--border-color);
          cursor: pointer;
          transition: all var(--transition-duration) ease;
          
          &:hover {
            transform: scale(1.2);
            box-shadow: 0 2px 4px rgba(0,0,0,0.2);
          }
        }
        .color-switch[data-color="transparent"] {
          position: relative;
          background-image: 
            linear-gradient(45deg, #ccc 25%, transparent 25%),
            linear-gradient(-45deg, #ccc 25%, transparent 25%),
            linear-gradient(45deg, transparent 75%, #ccc 75%),
            linear-gradient(-45deg, transparent 75%, #ccc 75%) !important;
          background-size: 8px 8px;
          background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
          border: 1px solid #ccc !important;
          
          &:hover {
            background-image: 
              linear-gradient(45deg, #aaa 25%, transparent 25%),
              linear-gradient(-45deg, #aaa 25%, transparent 25%),
              linear-gradient(45deg, transparent 75%, #aaa 75%),
              linear-gradient(-45deg, transparent 75%, #aaa 75%) !important;
          }
        }
      }
    }
  `
}
